load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "gcp",
    srcs = [
        "gcp_kms.go",
        "gcp_kms_connection.go",
        "gcs_connection.go",
        "gcs_retry.go",
        "gcs_storage.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/cloud/gcp",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/cloud",
        "//pkg/cloud/cloudpb",
        "//pkg/cloud/externalconn",
        "//pkg/cloud/externalconn/connectionpb",
        "//pkg/cloud/externalconn/utils",
        "//pkg/server/telemetry",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/util/ioctx",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "@com_github_cockroachdb_errors//:errors",
        "@com_google_cloud_go_kms//apiv1",
        "@com_google_cloud_go_kms//apiv1/kmspb",
        "@com_google_cloud_go_storage//:storage",
        "@io_opentelemetry_go_otel//attribute",
        "@org_golang_google_api//googleapi",
        "@org_golang_google_api//impersonate",
        "@org_golang_google_api//iterator",
        "@org_golang_google_api//option",
        "@org_golang_google_api//transport/http",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_golang_google_protobuf//types/known/wrapperspb",
        "@org_golang_x_net//http2",
        "@org_golang_x_oauth2//:oauth2",
    ],
)

go_test(
    name = "gcp_test",
    srcs = [
        "error_test.go",
        "gcp_kms_test.go",
        "gcs_storage_test.go",
    ],
    embed = [":gcp"],
    deps = [
        "//pkg/base",
        "//pkg/cloud",
        "//pkg/cloud/cloudtestutils",
        "//pkg/security/username",
        "//pkg/settings/cluster",
        "//pkg/testutils",
        "//pkg/testutils/skip",
        "//pkg/util/ioctx",
        "//pkg/util/leaktest",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_googleapis_gax_go_v2//apierror",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_google_cloud_go_kms//apiv1",
        "@com_google_cloud_go_storage//:storage",
        "@org_golang_google_api//googleapi",
        "@org_golang_google_api//impersonate",
        "@org_golang_x_oauth2//google",
    ],
)
